import request from '@/utils/request'
import querystring from 'querystring'
/**
 * 综合单非编辑查看详情
 * @param {*} id 
 */
export function getSynthesizeById(id) {
  return request.get('/synthesize/detail/' + id)
}
/**
 * 综合单编辑详情
 * @param {*} id 
 */
export function synthesizeFindById(id) {
  return request.get(`/synthesize/findById/${id}`)
}
/**
 * 综合单新增
 * @param {*} param 
 */
export function addSynthesize(param) {
  return request.post('/synthesize/save', param)
}

/**
 * 综合单修改
 * @param {*} param 
 */
export function editSynthesize(param) {
  return request.put('/synthesize/save', param)
}

/**
 * 综合单子删除
 * @param {*} id 
 */
export function deleteSynthesize(id) {
  return request.delete('/synthesize/del/' + id)
}

/**
 * 综合单-工单精品分页
 * @param {*} param 
 * @param {*} pageSize 
 * @param {*} pageNo 
 */
export function synthesizeJpPage(param, pageSize, pageNo) {
  const data = {
    pageNo,
    pageSize,
    param: {
      ...param
    }
  }
  return request.post('/synthesize/jpPage', data)
}
/**
 * 综合单分页
 * @param {*} param 
 * @param {*} pageSize 
 * @param {*} pageNo 
 */
export function syntheizeList(param, pageSize, pageNo) {
  const data = {
    pageNo,
    pageSize,
    param: {
      ...param
    }
  }
  return request.post('/synthesize/page', data)
}
/**
 * 工单配件分页
 * @param {*} param 
 * @param {*} pageSize 
 * @param {*} pageNo 
 */
export function synthesizePartsPage(param, pageSize, pageNo) {
  const data = {
    pageNo,
    pageSize,
    param: {
      ...param
    }
  }
  return request.post('/synthesize/partsPage', data)
}
/**
 * 综合单返工接口
 * @param {*} param 
 * @param {*} pageSize 
 * @param {*} pageNo 
 */
export function synthesizeProjectReworkPage(param, pageSize, pageNo) {
  const data = {
    pageNo,
    pageSize,
    param: {
      ...param
    }
  }
  return request.post('/synthesizeProjectRework/page', data)
}

/**
 * 综合单返工确认
 * @param {*} param 
 */
export function reworkSave(param) {
  return request.put('/synthesizeProjectRework/rework', param)
}

/**
 * 综合单项目管理分页
 * @param {*} param 
 * @param {*} pageSize 
 * @param {*} pageNo 
 */
export function synthesizeProjectPage(param, pageSize, pageNo) {
  const data = {
    pageNo,
    pageSize,
    param: {
      ...param
    }
  }
  return request.post('/synthesizeProject/page', data)
}
//工单增项
export function synthesizeInsProject(param) {
  return request.put(`/synthesize/insProject`, param)
}

//生成工单编号
export function synthesizeGetWorkOrderCode() {
  return request.get(`/synthesize/getWorkOrderCode`)
}

/**
 * 综合单派工
 * @param {*} id 
 */
export function synthesizeDispatch(id) {
  return request.get(`/synthesize/dispatch/${id}`)
}

//工单配料确定退料接口
export function synthesizeReturnMaterial(param) {
  return request.post(`/synthesize/returnMaterial`,param)
}

//工单精品确定退料接口
export function synthesizeReturnJpMaterial(param) {
  return request.post(`/synthesize/returnJpMaterial`,param)
}

//工单精品确认换料
export function synthesizeChangeJpMaterial(param) {
  return request.post(`/synthesize/changeJpMaterial`,param)
}


//工单配件确认换料
export function synthesizeChangePartsMaterial(param) {
  return request.post(`/synthesize/changePartsMaterial`,param)
}